import { createApp } from 'vue'
import App from './App.vue'

import registerIcons from '@/icons'

import 'virtual:svg-icons-register'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 国际化中文
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

// 引入自定义css
import '@/assets/styles/reset.css'
import '@/assets/styles/border.css'
import '@/assets/styles/global.css'

// 1. 引入pinia
import { createPinia } from 'pinia'
// 2. 创建pinia实例
const pinia = createPinia()

// 引入路由器
import router from './router'

const app = createApp(App)
registerIcons(app)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus, {
  locale: zhCn,
})
app.use(pinia)
app.use(router)

// 处理改变窗口大小时报错
// const originalError = console.error
// console.error = (...args) => {
//   if (args[0] && typeof args[0] === 'string' && args[0].includes('ResizeObserver')) {
//     return
//   }
//   originalError.apply(console, args)
// }


app.mount('#app')
